#include<stdio.h>
int main()
{int i = 0;//数组下标
  int b = 0;//计算几位数
   int n;
    scanf("%d",&n);
    int arr[5] = { 0 };
    arr[i];//定义数组下标
    while( n != 0)
    {
        arr[i] = n % 10;
        i++;
        n = n / 10;
        b++;
    }

        printf("%d\n", b);

        for (i = 0; i < b; i++) //顺序打印
        {
            printf("%d ", arr[i]);
        }
        printf("\n");
        for (i = b - 1; i >= 0; i--)//逆序打印
        {
            printf("%d ", arr[i]);
        }

        return 0;


}
